/*
 * @Author: qin
 * @Date:   2018-08-28
 * +----------------------------------------------------------------------
 * | admin [ 后台管理系统公共配置信息 ]
 * |
 * +----------------------------------------------------------------------
 */
layui.define(['jquery'], function (exports) {
    var $ = layui.jquery;
    var bsColor = {
        bsColor: function (d) {
            var bgColor = '';
            var color= '';
            var count = parseInt(d.remainingCount);
            if(count>5){
                bgColor = '#ddd';
                color = '#333';
            }else if(count<=5 && count>3){
                bgColor = 'yellow';
                color = '#333';
            }else if(count<=3){
                bgColor = 'red';
                color = '#fff';
            }
            var html = '<div class="">剩余天数<span class="countStyle" style="background:'+bgColor+';color:'+color+'">'+count+'</span></div>';

            return html;
        }
    };
    $('.colorList').on('mouseover', 'tr', function () {
        var lastNum = $(this).first('td').children().children().children().data('id');
        if (lastNum && lastNum !== 1000) {
            var title = '';
            if (lastNum < 0) {
                title = '已超出' + Math.abs(lastNum) + '天';
            } else {
                title = '剩余天数' + lastNum;
            }
            $(this).attr('title', title);
        }
    });
    exports('bsColor', bsColor);
});